﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using EOSCRM.Dao;
using EOSCRM.Domain;
namespace EOSCRM.Dao
{
    public class ReportCongNo
    {
        public DataSet CN_BANGKECHITIETHOADONTONDENTHANG(int thang,int nam,String makv,String maPhuong,String loaikhachhang,DateTime NgayLap)
        {
            Database db = new Database();
            SqlParameter[] prams = {
                    db.MakeInParam("@THANG", SqlDbType.Int,4,thang),
                    db.MakeInParam("@NAM", SqlDbType.Int  , 8,nam),
                    db.MakeInParam("@MAKV", SqlDbType.VarChar  , 10, makv ),
                    db.MakeInParam("@MAPHUONG", SqlDbType.VarChar  , 10, maPhuong ),
                    db.MakeInParam("@MALKH",SqlDbType.VarChar,2,loaikhachhang),
                    db.MakeInParam("@NGAYLAP", SqlDbType.DateTime, 8, NgayLap)
                               };
            DataSet ds = db.RunExecProc("[CN_BANGKEHOADONTONDENTHANG]", prams);
            db.Dispose();
            return ds;
        }
        public DataSet CN_BANGKECHITIETHOADONTONTUNGKY(int thang, int nam, String makv, String maPhuong, String loaikhachhang, DateTime NgayLap)
        {
            Database db = new Database();
            SqlParameter[] prams = {
                    db.MakeInParam("@THANG", SqlDbType.Int,4,thang),
                    db.MakeInParam("@NAM", SqlDbType.Int  , 8,nam),
                    db.MakeInParam("@MAKV", SqlDbType.VarChar  , 10, makv ),
                    db.MakeInParam("@MAPHUONG", SqlDbType.VarChar  , 10, maPhuong ),
                    db.MakeInParam("@MALKH",SqlDbType.VarChar,2,loaikhachhang),
                     db.MakeInParam("@NGAYLAP", SqlDbType.DateTime, 8, NgayLap)
                               };
            DataSet ds = db.RunExecProc("[CN_BANGKEHOADONTONTUNGKY]", prams);
            db.Dispose();
            return ds;
        }
        public DataSet CN_BANGKETONGHOADONTONTUNGKY(int thang, int nam, String makv, String maPhuong, String loaikhachhang)
        {
            Database db = new Database();
            SqlParameter[] prams = {
                    db.MakeInParam("@THANG", SqlDbType.Int,4,thang),
                    db.MakeInParam("@NAM", SqlDbType.Int  , 8,nam),
                    db.MakeInParam("@MAKV", SqlDbType.VarChar  , 10, makv ),
                    db.MakeInParam("@MAPHUONG", SqlDbType.VarChar  , 10, maPhuong ),
                    db.MakeInParam("@MALKH",SqlDbType.VarChar,2,loaikhachhang)
                               };
            DataSet ds = db.RunExecProc("[CN_BANGKETONGHOPHOADONTONTUNGKY]", prams);
            db.Dispose();
            return ds;
        }
        public DataSet CN_BANGKECHITIETHOADONCHENHLECH(int thang, int nam, String makv,String maPhuong, String loaikhachhang)
        {
            Database db = new Database();
            SqlParameter[] prams = {
                    db.MakeInParam("@THANG", SqlDbType.Int,4,thang),
                    db.MakeInParam("@NAM", SqlDbType.Int  , 8,nam),
                    db.MakeInParam("@MAKV", SqlDbType.VarChar  , 10, makv ),
                    db.MakeInParam("@MAPHUONG", SqlDbType.VarChar  , 10, maPhuong ),
                    db.MakeInParam("@MALKH",SqlDbType.VarChar,2,loaikhachhang)
                               };
            DataSet ds = db.RunExecProc("CN_BANGKEHOADONCHENHLECH", prams);
            db.Dispose();
            return ds;
        }
        public DataSet CN_BANGKETHUNGAN(int thang, int nam, DateTime tuNgay, DateTime denNgay, string manv,string sophieu)
        {
            var db = new Database();
            SqlParameter[] prams = {
                                    db.MakeInParam("@TUNGAY", SqlDbType.DateTime, 8, tuNgay),
                                    db.MakeInParam("@DENNGAY", SqlDbType.DateTime, 8, denNgay),
                                    db.MakeInParam("@MANVT",SqlDbType.VarChar,10,manv),
                                    db.MakeInParam("@SOPHIEU",SqlDbType.VarChar,10,sophieu),
                                    db.MakeInParam("@THANG", SqlDbType.Int, 4, thang),
                                    db.MakeInParam("@NAM", SqlDbType.Int, 4, nam),
                                    
                               };
            var ds = db.RunExecProc("[CN_BANGKETHUNGAN]", prams);
            db.Dispose();
            return ds;
        }
        public DataSet CN_KETQUATHUCUANHANVIEN(int thang, int nam, DateTime tuNgay, DateTime denNgay, string manv, string sophieu)
        {
            var db = new Database();
            SqlParameter[] prams = {
                                    db.MakeInParam("@TUNGAY", SqlDbType.DateTime, 8, tuNgay),
                                    db.MakeInParam("@DENNGAY", SqlDbType.DateTime, 8, denNgay),
                                    db.MakeInParam("@MANVT",SqlDbType.VarChar,10,manv),
                                    db.MakeInParam("@SOPHIEU",SqlDbType.VarChar,10,sophieu),
                                    db.MakeInParam("@THANG", SqlDbType.Int, 4, thang),
                                    db.MakeInParam("@NAM", SqlDbType.Int, 4, nam),
                                    
                               };
            var ds = db.RunExecProc("[CN_KETQUATHUCUANHANVIEN]", prams);
            db.Dispose();
            return ds;
        }
        public DataSet CN_KETQUATHUCTHUCUANHANVIEN(int thang, int nam, DateTime tuNgay, DateTime denNgay, string machinhanh)
        {
            var db = new Database();
            SqlParameter[] prams = {
                                    db.MakeInParam("@TUNGAY", SqlDbType.DateTime, 8, tuNgay),
                                    db.MakeInParam("@DENNGAY", SqlDbType.DateTime, 8, denNgay),
                                    db.MakeInParam("@THANG", SqlDbType.Int, 4, thang),
                                    db.MakeInParam("@NAM", SqlDbType.Int, 4, nam),
                                    db.MakeInParam("@MACN", SqlDbType.VarChar, 10,machinhanh),
                                    
                               };
            var ds = db.RunExecProc("[CN_KETQUATHUCTHUCUANHANVIEN]", prams);
            db.Dispose();
            return ds;
        }
        public DataSet CN_BANGKECHUANTHUCTONHOADON(int thang, int nam, string makv,string maphuong)
        {
            var db = new Database();
            SqlParameter[] prams = {
                                    db.MakeInParam("@THANG", SqlDbType.Int, 4, thang),
                                    db.MakeInParam("@NAM", SqlDbType.Int, 4, nam),
                                    db.MakeInParam("@MAKV",SqlDbType.VarChar,10,makv),
                                    db.MakeInParam("@MAPHUONG",SqlDbType.VarChar,10,maphuong)
                               };
            var ds = db.RunExecProc("[CN_BANGKECHUANTHUCTONHOADON]", prams);
            db.Dispose();
            return ds;
        }
        public DataSet CN_BANGKECHITIETTHUCTHUTUNGKY(int thang, int nam, String makv, String maPhuong, String loaikhachhang)
        {
            Database db = new Database();
            SqlParameter[] prams = {
                    db.MakeInParam("@THANG", SqlDbType.Int,4,thang),
                    db.MakeInParam("@NAM", SqlDbType.Int  , 8,nam),
                    db.MakeInParam("@MAKV", SqlDbType.VarChar  , 10, makv ),
                    db.MakeInParam("@MAPHUONG", SqlDbType.VarChar  , 10, maPhuong ),
                    db.MakeInParam("@MALKH",SqlDbType.VarChar,2,loaikhachhang)
                               };
            DataSet ds = db.RunExecProc("[CN_BANGKETHUTHUCHITIET]", prams);
            db.Dispose();
            return ds;
        }
        public DataSet CN_BANGKETONGHOADONTHUCTHUTUNGKY(int thang, int nam, String makv, String maPhuong, String loaikhachhang)
        {
            Database db = new Database();
            SqlParameter[] prams = {
                    db.MakeInParam("@THANG", SqlDbType.Int,4,thang),
                    db.MakeInParam("@NAM", SqlDbType.Int  , 8,nam),
                    db.MakeInParam("@MAKV", SqlDbType.VarChar  , 10, makv ),
                    db.MakeInParam("@MAPHUONG", SqlDbType.VarChar  , 10, maPhuong ),
                    db.MakeInParam("@MALKH",SqlDbType.VarChar,2,loaikhachhang)
                               };
            DataSet ds = db.RunExecProc("[CN_BANGKETONGHOADONTHUCTHUTUNGKY]", prams);
            db.Dispose();
            return ds;
        }

        public DataSet CN_BAOCAOTHUCTHUTONGHOPCACCHINHANH(int thang, int nam)
        {
            Database db = new Database();
            SqlParameter[] prams = {
                                   db.MakeInParam("@THANG", SqlDbType.Int, 4, thang),
                                   db.MakeInParam("@NAM", SqlDbType.Int, 4, nam)
                               };
            DataSet ds = db.RunExecProc("CN_BAOCAOTHUCTHUTONGHOPCACCHINHANH", prams);
            db.Dispose();
            return ds;
        }
        public DataSet CN_BAOCAOTHUETONGHOPCACCHINHANH(int thang, int nam)
        {
            Database db = new Database();
            SqlParameter[] prams = {
                                   db.MakeInParam("@THANG", SqlDbType.Int, 4, thang),
                                   db.MakeInParam("@NAM", SqlDbType.Int, 4, nam)
                               };
            DataSet ds = db.RunExecProc("CN_BAOCAOTHUETONGHOPCACCHINHANH", prams);
            db.Dispose();
            return ds;
        }
        public DataSet CN_BANGKEKHTONTRONGNAM(int nam, String makv, String maPhuong, String mahttt, DateTime NgayLap, int sokyno)
        {
            Database db = new Database();
            SqlParameter[] prams = {
                    db.MakeInParam("@NAM", SqlDbType.Int  , 8,nam),
                    db.MakeInParam("@MAKV", SqlDbType.VarChar  , 10, makv ),
                    db.MakeInParam("@MAPHUONG", SqlDbType.VarChar  , 10, maPhuong ),
                    db.MakeInParam("@MAHTTT",SqlDbType.VarChar,2,mahttt),
                    db.MakeInParam("@NGAYLAP", SqlDbType.DateTime, 8, NgayLap),
                    db.MakeInParam("@SOKYNO", SqlDbType.Int, 8, sokyno),
                               };
            DataSet ds = db.RunExecProc("[CN_BANGKEKHTONTRONGNAM]", prams);
            db.Dispose();
            return ds;
        }
    }
    
}
